package com.train.daily.api;

import com.train.common.constants.ApiConstants;
import com.train.common.resp.CommonResp;
import com.train.daily.api.fallback.DailyTrainApiFallback;
import com.train.daily.dto.train.DailyTrainExistsDTO;
import com.train.daily.dto.train.DailyTrainValidationDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * dailyTrain api 接口
 * @author baitiaojun
 * @createDate 2025-02-28 17:55:24
 */
@FeignClient(
        contextId = "dailyTrainApi",
        name = ApiConstants.DAILY_TRAIN_NAME,
        path = ApiConstants.DAILY_TRAIN_PREFIX,
        fallback = DailyTrainApiFallback.class)
public interface DailyTrainApi {

    String PREFIX =  "/train";

    @PostMapping(PREFIX + "/generate-train/{date}")
    CommonResp generateDailyTrain(@PathVariable("date") String date);

    @PostMapping(PREFIX + "/exists")
    CommonResp existsTrain(@RequestBody DailyTrainExistsDTO dto);

    @PostMapping(PREFIX + "/valid/time")
    CommonResp validTrainTime(@RequestBody DailyTrainValidationDTO dto);
}
